<template>
  <div v-show="visible">
    <el-switch
      v-model="value1"
      active-text="按月付费"
      inactive-text="按年付费"
      @change="changeParent"
    >
    </el-switch>
  </div>
</template>

<script>
export default {
  props: ['visible'],
  data () {
    return {
      value1: false
    }
  },
  methods: {
    changeParent () {
      this.$parent.visible = false
    }
  },
  mounted () {
    document.addEventListener('click', (e) => {
      console.log(e)
      console.log(this.$parent)
      // this.$parent.visible = false
    })
  }
}
</script>

<style>

</style>